//
//  HttpResponse.m
//  RedGrass
//
//  Created by wukong on 2018/12/29.
//  Copyright © 2018年 hongcaosp. All rights reserved.
//

#import "HttpResponse.h"

@interface HttpResponse()

@property (nonatomic,strong) NSString *message;
@property (nonatomic,assign) NSInteger code;
@property (nonatomic,strong) id data;

@end

@implementation HttpResponse

-(instancetype)initWith:(NSDictionary *)data {
    self = [super init];
    if (self) {
        self.message = [data objectForKey:@"msg"];
        self.code = [[data objectForKey:@"code"] integerValue];
        if([data objectForKey:@"data"]){
            self.data = [data objectForKey:@"data"];
        }
    }
    return self;
}

-(id)getResult {
    return _data;
}

-(BOOL)isBusinessOk {
    return _code == 0;
}

-(NSString *)getBusinessMsg {
    return _message;
}

-(NSInteger)getBuinessCode {
    return _code;
}


@end
